import Vue from "vue";
import Router from "vue-router";
import routes, { other } from "./config";


Vue.use(Router);
routes[0].children = routes[0].children.concat(other);
const router = new Router({
  routes
  // ,
  // scrollBehavior(to, from, savedPosition) {
  //   console.log("scrollBehavior", to, from, savedPosition);
  // }
});

// router.beforeResolve((to, from, next) => {
//   const toLen = to.fullPath.substr(1).split("/").length;
//   const fromLen = from.fullPath.substr(1).split("/").length;
//   if(toLen === fromLen){
//     next({name: "Home"});
//   }
//   next();
// });

// router.beforeEach((to, from, next) => {
//   alert(to.query.newToken);
//   next();
// });


export default router;
